<template>
  <div>
    <h2>welcome</h2>
    <div class="btn">
      <button @click="back">后退</button>
      <button @click="forward">前进</button>
      <button @click="backOrForword">go前进/后退指定步数</button>
    </div>
  </div>
</template>

<script>
export default {
  name:"Banner",
  methods:{
    back(){
      this.$router.back(); //后退
    },
    forward(){
      this.$router.forward(); //前进
    },
    backOrForword(){
      this.$router.go(-2); //后退2步
   }
 }
}
</script>

<style scoped>
  .btn button{
    margin-left: 5px;
  }
</style>